<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8" />
  <title>管理员登录</title>
  <link rel="stylesheet" href="/static/styles.css" />
  <style>
    .login-card{max-width:380px;margin:80px auto;background:var(--card);border:1px solid var(--border);border-radius:14px;padding:20px;}
    .login-card h2{margin:0 0 12px;}
    .login-card input{width:100%;margin:6px 0;padding:10px;border:1px solid var(--border);border-radius:10px;background:var(--card);color:var(--text);}
    .login-card button{width:100%;padding:10px;border:1px solid var(--border);border-radius:10px;cursor:pointer;}
    .error{color:#ef4444;margin:8px 0;}
  </style>
</head>
<body>
  <div class="login-card">
    <h2>管理员登录</h2>
    {% if error %}<div class="error">{{ error }}</div>{% endif %}
    <form method="post" action="/login">
      <input type="text" name="username" placeholder="用户名" required />
      <input type="password" name="password" placeholder="密码" required />
      <button type="submit" class="btn btn-primary">登录</button>
    </form>
    <p style="margin-top:10px;"><a href="/" class="link-login">返回只读页</a></p>
  </div>
<script>
    (function () {
      const saved = localStorage.getItem("theme-mode") || "auto";
      const root = document.documentElement;
      if (saved === "light") {
        root.setAttribute("data-theme", "light");
      } else if (saved === "dark") {
        root.setAttribute("data-theme", "dark");
      } else {
        // auto：跟随系统；移除强制属性，交给 CSS 的 prefers-color-scheme
        root.removeAttribute("data-theme");
      }
    })();
</script>


</body>
</html>
